package com.atguigu.tingshu.user.client;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.user.UserPaidTrack;
import com.atguigu.tingshu.model.user.UserVipService;
import com.atguigu.tingshu.model.user.VipServiceConfig;
import com.atguigu.tingshu.user.client.impl.UserDegradeFeignClient;
import com.atguigu.tingshu.vo.user.UserInfoVo;
import com.atguigu.tingshu.vo.user.UserPaidRecordVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 产品列表API接口
 * </p>
 *
 * @author atguigu
 */
@FeignClient(value = "service-user", fallback = UserDegradeFeignClient.class)
public interface UserFeignClient {


    /**
     * 提供给专辑服务调用，获取当前用户已购声音集合
     *
     * @param albumId
     * @return
     */
    @GetMapping("/api/user/userInfo/findUserPaidTrackList/{albumId}")
    public Result<List<Long>> getUserPaidTrackIdList(@PathVariable Long albumId);
    @GetMapping("/api/user/userInfo/getUserInfoVo/{userId}")
    public Result<UserInfoVo> getUserVoById(@PathVariable("userId") Long userId);
    /**
     * 该接口提供给给专辑服务，展示声音列表动态判断付费标识
     * 判断当前用户某一页中声音列表购买情况
     *
     * @param userId               用户ID
     * @param albumId              专辑ID
     * @param needChackTrackIdList 待检查购买情况声音列表
     * @return data:{声音ID：购买结果}   结果：1（已购）0（未购买）
     */
    @PostMapping("/api/user/userInfo/userIsPaidTrack/{userId}/{albumId}")
    public Result<Map<Long, Integer>> userIsPaidTrack(
            @PathVariable Long userId,
            @PathVariable Long albumId,
            @RequestBody List<Long> needChackTrackIdList);
    /**
     * 根据套餐ID查询VIP套餐详情
     *
     * @param id
     * @return
     */
    @GetMapping("/api/user/vipServiceConfig/getVipServiceConfig/{id}")
    public Result<VipServiceConfig> getVipServiceConfig(@PathVariable Long id);

    /**
     * 提供给订单服务调用，验证当前用户是否购买过专辑
     * @param albumId
     * @return
     */
    @GetMapping("/api/user/userInfo/isPaidAlbum/{albumId}")
    public Result<Boolean> isPaidAlbum(@PathVariable Long albumId);
    @PostMapping("/api/user/userInfo/saveUserVip")
    void saveUserVip(@RequestBody UserVipService userVipService);
    @PostMapping("/api/user/userInfo/saveUserPaidTrack")
    void saveUserPaidTrack(@RequestBody UserPaidTrack userPaidTrack);
    /**
     * 处理用户购买记录（虚拟物品发货）
     *
     * @param userPaidRecordVo
     * @return
     */
    @PostMapping("/api/user/userInfo/savePaidRecord")
    public Result savePaidRecord(@RequestBody UserPaidRecordVo userPaidRecordVo);
}
